<form id="cityaddfm" method="post" style="padding: 8px;">
    <table class="formtable" border="0" width="100%" cellspacing="1" cellpadding="5">
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" width="20%">上级：</td>
            <td width="80%">
                <SELECT name='up' style="width:153px; height:25px;" size='1' v-model="params.up">
                    <OPTION value="0">根目录</OPTION>
                    <OPTION value="0" disabled="disabled"> -----------------</OPTION>
                    <template v-for="(vo,index) in city">
                        <OPTION :value="vo.id">{{vo.name}}</OPTION>
                    </template>
                </SELECT>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" width="20%">名称：</td>
            <td width="80%"><input type="text" style="width:200px;"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入名称.." required="true" v-model="params.name"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" width="20%">排序：</td>
            <td width="80%"><input type="text"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入排序.." v-model="params.sortorder"></td>
        </tr>
    </table>
</form>
<script>
    var cityaddVm = new Vue({
        el: '#cityaddfm',
        data: {
            params: {
                up: 0,
                name: '',
                sortorder: 500,
            },
            city: JSON.parse('<?php echo $city;?>'),
        }
    });
    $(function () {
        $('#cityaddsubmit').click(function () {
            $.post('/admin/index/cityinsert', cityaddVm.params, function (data) {
                if (parseInt(data.ret) === 0) {
                    $.messager.show({
                        title: '提示',
                        msg: data.msg,
                        timeout: 3000,
                        showType: 'slide'
                    });
                    $("#cityaddfm").form('clear');
                    $("#citydlg").dialog('close');
                    $("#city").treegrid('reload');
                } else {
                    $.messager.alert('提示', data.msg, 'warning');
                }
            }, 'json');
        })
    });
</script>
